﻿using System.Collections;
using System.Collections.Generic;
using Meqs.Entity;
using Meqs.Logic.Interface;

namespace Meqs.Logic.Implement
{
    public class CouseGradeInfoLogic : CommonLogic<CouseGradeInfo, int>, ICouseGradeInfoLogic
    {
        #region Implementation of ICommonLogic<CauseInfo, int>

        /// <sammury>
        /// 创建对象
        /// </sammury>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Create(CouseGradeInfo entity)
        {
            CreateObject(entity);
            return entity.RID;
        }

        /// <sammury>
        /// 更新对象
        /// </sammury>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Update(CouseGradeInfo entity)
        {
            return UpdateObject(entity);
        }

        /// <summary>
        /// 删除对象
        /// </summary>
        /// <param name="entityId"></param>
        /// <returns></returns>
        public int Delete(int entityId)
        {
            return DeleteObject(entityId);
        }

        /// <summary>
        /// 删除所有对象
        /// </summary>
        /// <returns></returns>
        public int DeleteAll()
        {
            return DeleteAllObject();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entityId"></param>
        /// <returns></returns>
        public CouseGradeInfo FindById(int entityId)
        {
            return FindObjectById(entityId);
        }

        /// <summary>
        /// 检索对象数量
        /// </summary>
        /// <returns></returns>
        public int FindCount()
        {
            return FindObjectByCount();
        }

        /// <sammury>
        /// 检索对象
        /// </sammury>
        public IList<CouseGradeInfo> FindAll()
        {
            return FindAllObject();
        }

        /// <summary>
        /// 检索对象数量
        /// </summary>
        /// <returns></returns>
        public int FindCount(Hashtable table)
        {
            return FindObjectByCount(table);
        }

        /// <sammury>
        /// 检索对象
        /// </sammury>
        public IList<CouseGradeInfo> FindAll(Hashtable table)
        {
            return FindObject(table);
        }

        #endregion


        public int DeleteBy(Hashtable ht)
        {
            return ExecuteDelete("CouseGradeInfo.DeleteBy", ht);
        }


        public IList<GlobalCauseInfo> GetCauseByExamClass(int clsId)
        {
            Hashtable ht = new Hashtable();
            ht.Add("ClsID",clsId);

            return FindCustomer<GlobalCauseInfo>("GlobalCauseInfo.GetCauseByExamClass",ht);
        }
    }
}
